<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <style>
     
    </style>
    <script src="/公开课/JS/vue.min.js"></script>
  </head>
  <body>
    <!-- vue只控制div -->
    <div id="app">
      <p v-html="msg"></p>
      <p v-once>{{msg1}}</p>
      <p v-bind:title="msg2">鼠标指针悬停</p>
      <p v-if="flag">现在你看到我了</p>
      <button v-on:click = "show">显示</button>
      <button v-on:click = "hide">隐藏</button>
      <!-- Vue里方法不用加小括号 -->
      <ol>
        <li v-for="todo in msg4">
          {{todo.text}}
        </li>
      </ol>

    </div>
    <!-- const定义常量的 -->
    <script>
      let vue = new Vue({
        el: "#app",
        data: {
          msg: "<a href='http://www.baidu.com'>lll</a>",
          msg1: "ddddddd",
          msg2: "网页加载于" + new Date().toLocaleString(),
          flag: true ,//取false是不显示msg3
          msg4:[{text:'学习js'},{text:'学习Vue'},{text:'早点毕业'}]
        },
        //创建方法
        methods:{
          show: function(){
            this.flag = true;
          },
          hide: function(){
            this.flag = false;
          }
        }
      });
    </script>
  </body>
</html>
